<html>
  <head>
    <title>Stick Figure Adventure</title>

    <script type="text/javascript">
      // Initialize the current scene to Scene 0 (Intro)
      var curScene = 0;

      function changeScene(decision) {
        // Clear the scene message
        var message = "";

        switch (curScene) {
        case 0:
          curScene = 1;
          message = "Your journey begins at a fork in the road.";
          break;
        case 1:
          if (decision == 1) {
            curScene = 2
            message = "You have arrived at a cute little house in the woods.";
          }
          else {
            curScene = 3;
            message = "You are standing on the bridge overlooking a peaceful stream.";
          }
          break;
        case 2:
          if (decision == 1) {
            curScene = 4
            message = "Peeking through the window, you see a witch inside the house.";
          }
          else {
            curScene = 5;
            message = "Sorry, a witch lives in the house and you just became part of her stew.";
          }
          break;
        case 3:
          if (decision == 1) {
            curScene = 6
            message = "Sorry, a troll lives on the other side of the bridge and you just became his lunch.";
          }
          else {
            curScene = 7;
            message = "Your stare is interrupted by the arrival of a huge troll.";
          }
          break;
        case 4:
          if (decision == 1) {
            curScene = 8
          }
          else {
            curScene = 5;
            message = "Sorry, you became part of the witch's stew.";
          }
          break;
        case 5:
          curScene = 0;
          break;
        case 6:
          curScene = 0;
          break;
        case 7:
          if (decision == 1) {
            curScene = 6
            message = "Sorry, you became the troll's tasty lunch.";
          }
          else {
            curScene = 9;
          }
          break;
        case 8:
          // TO BE CONTINUED
          break;
        case 9:
          // TO BE CONTINUED
          break;
        }

        // Update the scene image
        document.getElementById("sceneimg").src = "scene" + curScene + ".png";

        // Update the scene description text
        var sceneText = document.getElementById("scenetext");
        while (sceneText.firstChild)
          sceneText.removeChild(sceneText.firstChild);
        sceneText.appendChild(document.createTextNode(message));
      }
    </script>
  </head>

  <body>
    <div style="margin-top:100px; text-align:center">
      <img id="sceneimg" src="scene0.png" alt="Stick Figure Adventure" /><br />
      <div id="scenetext"></div><br />
      Please choose:
      <input type="button" id="decision1" value="1" onclick="changeScene(1)" />
      <input type="button" id="decision2" value="2" onclick="changeScene(2)" />
    </div>
  </body>
</html>
